#include <stdio.h>
#include <stdlib.h>

// 全局变量
int global_counter = 100;
char global_message[] = "Hello, World!";
static int static_var = 42;

// 函数参数和局部变量
void test_function(int param1, char param2) {
    int local_var1 = 10;
    static int static_local = 5;
    char local_str[] = "local string";
    
    printf("test_function called with params: %d, %c\n", param1, param2);
    printf("local_var1 = %d, static_local = %d\n", local_var1, static_local);
    printf("local_str = %s\n", local_str);
    
    // 修改变量值
    local_var1++;
    static_local++;
    global_counter++;
}

int main() {
    int main_local = 999;
    char main_str[] = "main function";
    double main_double = 3.14159;
    
    printf("=== 变量测试程序 ===\n");
    printf("全局变量:\n");
    printf("  global_counter = %d\n", global_counter);
    printf("  global_message = %s\n", global_message);
    printf("  static_var = %d\n", static_var);
    
    printf("主函数局部变量:\n");
    printf("  main_local = %d\n", main_local);
    printf("  main_str = %s\n", main_str);
    printf("  main_double = %f\n", main_double);
    
    // 调用测试函数
    test_function(123, 'A');
    
    printf("=== 程序结束 ===\n");
    return 0;
}